#include <iostream>
#include <map>

#include "../../libpland/lib/coreploader.hpp"
#include "../../libpland/lib/coreqmanager.hpp"
#include "../../libpland/lib/coresettings.hpp"

using namespace std;

int main()
{
	CoreC_Settings *set = CoreC_Settings::Instance();
	set->start();
	CoreC_QueueManager *man = CoreC_QueueManager::Instance();
	CoreC_Plugin* decoder = CoreC_PLoader::loadPlugin("./libplugogg.so", 1);
	CoreC_Plugin* scaler = CoreC_PLoader::loadPlugin("./libplugscaler.so", 2);
	CoreC_Plugin* output = CoreC_PLoader::loadPlugin("./libplugoutput.so", 3);
	CoreC_Plugin* echo = CoreC_PLoader::loadPlugin("./libplugecho.so", 4);

	CoreC_DQueue *qdecoder = new CoreC_DQueue;
	CoreC_DQueue *qscaler = new CoreC_DQueue;
	CoreC_DQueue *qecho = new CoreC_DQueue;
	man->addQueueu("decoder", (CoreC_Data_Queue<void*>*)qdecoder);
	man->addQueueu("scaler", (CoreC_Data_Queue<void*>*)qscaler);
	man->addQueueu("echo", (CoreC_Data_Queue<void*>*)qecho);
	man->start();

	decoder->getUserPlugin()->load_queues(NULL, qdecoder);
	scaler->getUserPlugin()->load_queues(qdecoder, qscaler);
	echo->getUserPlugin()->load_queues(qscaler,qecho);
	output->getUserPlugin()->load_queues(qecho, NULL);
	output->start();
	decoder->start();
	scaler->start();
	echo->start();
	char a;
	cin >> a;
	return 0;
}
